<?php

require_once 'model/LoginHandler.php';
require_once 'view/LoginView.php';
require_once 'view/TextStringOutput.php';
require_once 'view/RegistrerView.php';


class MasterController{
	
	private $m_loginController;
	private $m_registerController;

	public function __construct(LoginController $a_loginController, RegisterController $a_registerController) {
		$this -> m_loginController = $a_loginController;
		$this -> m_registerController = $a_registerController;
	}
	
	// Ropas på från index
	public function DoControll() {
		$string = "";
		$loginView = new LoginView();
		$registerView = new RegistrerView();
		$textStringOutput = new TextStringOutput();
		// Om RegisterButton klickas...
		if(isset($_GET[LoginView::RegisterButton])) {
			// kör DoControll från RegisterController...	
			$string = $this->m_registerController -> DoControll();
		}
		// Annars från logincontroller
		else{
			$string = $this->m_loginController -> DoControll();
		}

		return $string;
	}
}
	